// types/customer.ts
export interface ContactPerson {
  id?: string
  name: string
  department?: string
  position?: string
  phone?: string
  email?: string
  address?: string
  isPrimary?: boolean
  remark?: string
}

export interface Customer {
  id: string
  name: string
  code?: string
  type: 'enterprise' | 'government' | 'education' | 'individual'
  level: 'vip' | 'important' | 'normal' | 'new'
  status: 'active' | 'inactive' | 'risk' | 'blacklist'
  contactPersons: ContactPerson[]
  email?: string
  address?: string
  region?: string
  industry?: string
  taxNumber?: string
  bankAccount?: string
  customerSource?: 'zcy' | 'referral' | 'self' | 'other'
  responsibleSalesman?: string
  creditRating: 'A' | 'B' | 'C' | 'D'
  creditScore: number
  orderCount: number
  totalOrderAmount: number
  avgOrderAmount: number
  overdueAmount: number
  overdueOrders: number
  overdueDays: number
  uninvoicedAmount: number
  lastOrderDate?: string
  activityLevel: 'high' | 'medium' | 'low'
  satisfactionScore: number
  notes?: string
  tags: string[]
  createdAt: string
  updatedAt: string
}

export interface CustomerQueryParams {
  page: number
  limit: number
  customerStatus?: string
  customerLevel?: string
  customerType?: string
  customerName?: string
  createDateRange?: string[]
  region?: string
  industry?: string
  customerSource?: string
  responsibleSalesman?: string
  minOrderCount?: number
  minTotalAmount?: number
  sortField?: string
  sortOrder?: 'asc' | 'desc'
}